package com.rv.admin.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.rv.admin.domain.User;
import com.rv.admin.domain.bo.LoginBo;
import com.rv.admin.service.IUserService;
import com.rv.common.core.domain.R;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @author sundez
 * @version 1.1.3.9
 * @since 2025/7/17
 */
@RestController
@RequestMapping("/user")

public class UserController {


    @Resource
    private IUserService iUserService;

    @PostMapping("/login")
    public R<User> login(@RequestBody LoginBo loginBo) {
        return iUserService.login(loginBo);
    }

    @PostMapping("/logout")
    public R<Boolean> logout(){
        return iUserService.logout();
    }

    @PostMapping("/register")
    public R<User> register(@RequestBody User user) {
        return iUserService.register(user);
    }

    @GetMapping("/list")
    public R<Page<User>> pageList(Page<User> page, User user) {
        return iUserService.pageList(page, user);
    }


}
